/**
 * @param {string} path
 * @returns {Boolean}
 */
export function isExternal(path) {
    return /^(https?:|mailto:|tel:)/.test(path)
}

/**
 * @param {string} val
 * @returns {Boolean}
 * 验证手机号
 */
export function validTel(val) {
    var pattern = /(^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$)|(^0{0,1}1[3|4|5|6|7|8|9][0-9]{9}$)/
    return pattern.test(val)
}
/**
 * @param {string} str
 * @returns {Boolean}
 * 验证邮箱地址
 */
export function validUsername(str) {
    var reg = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;
    return reg.test(str)
}

/**
 * 验证数字
 */
export function validNum(num) {
    var reg = /\b[1-9]\b|([0-9]\d+)/
    return reg.test(num)
}